<?php
/**
 * Description:
 * Author: hezhizheng
 * Date: 2018/6/1
 * Time: 9:29
 * Created by Created by Panxsoft.
 */

namespace App\Http\Controllers\Common;

use App\Http\Controllers\ApiController;
use App\Services\DataV\DataVRepository;


class DataVController extends ApiController
{
    protected $dataVRepository;

    public function __construct(DataVRepository $dataVRepository)
    {
        $this->dataVRepository = $dataVRepository;
    }

    /**
     * 所有查询都走show方法
     *
     * @param string $_ratio
     * @return mixed|array
     */
    public function show($_ratio)
    {
        return $this->{camel_case($_ratio)}();
    }

    /**
     * 性别
     * @return array
     */
    public function genderRatio()
    {
        return $this->dataVRepository->getGenderRatio();
    }

    /**
     * 年龄
     * @return array
     */
    public function ageRatio()
    {
//        return collect( $this->dataVRepository->getAgeRatio() )->sum('count');
        return $this->dataVRepository->getAgeRatio();
    }

    /**
     * 单品
     * @return array
     */
    public function singleProductListRatio()
    {
        return $this->dataVRepository->getSingleProductListRatio();
    }

    /**
     * 用户数据
     * @return mixed
     */
    public function wechatUserRatio()
    {
        return $this->dataVRepository->getWechatUserRatio();

    }

    /**
     * 店铺数据
     *
     * @return mixed
     */
    public function storeRatio()
    {
        return $this->dataVRepository->getStoreRatio();

    }

    /**
     * 设备开启
     * @return mixed
     */
    public function deviceRatio()
    {
        return $this->dataVRepository->getDeviceRatio();
    }

    public function waxRatio()
    {

        return $this->dataVRepository->getWaxRatio();

    }

    public function hmRatio()
    {
        return $this->dataVRepository->getHmRatio();
    }
}